//
//  WH_AllOrderCell.m
//  App_6.23
//
//  Created by wanghao on 16/7/19.
//  Copyright © 2016年 wanghao. All rights reserved.
//

#import "WH_AllOrderCell.h"
#import "WH_Home.h"
@interface WH_AllOrderCell ()

@property (weak, nonatomic) IBOutlet UIImageView *productImage;
@property (weak, nonatomic) IBOutlet UILabel *productNameL;
@property (weak, nonatomic) IBOutlet UILabel *periodL;
@property (weak, nonatomic) IBOutlet UILabel *numbL;
@property (weak, nonatomic) IBOutlet UILabel *userNameL;
@property (weak, nonatomic) IBOutlet UILabel *countL;
@property (weak, nonatomic) IBOutlet UILabel *productTimeL;
@property (weak, nonatomic) IBOutlet UILabel *orderTimeL;
@property (weak, nonatomic) IBOutlet UILabel *winNumL;

@end
@implementation WH_AllOrderCell

-(void)setOrder:(WH_Home *)order{
    
    if (_order != order) {
        
        _order = order;
    }
    [self.productImage sd_setImageWithURL:[NSURL URLWithString:_order.product_image] placeholderImage:PLACEHOLDER_CELL_SAME];
    self.productNameL.text = _order.product_name;
    self.productNameL.numberOfLines = 2;
    self.periodL.text = [NSString stringWithFormat:@"参与期号:  %@",_order.product_period_no];
    self.numbL.text = [NSString stringWithFormat:@"已参与:  %@人次",_order.order_num];
    [WH_AppTools changeColor:self.numbL.text color:[UIColor redColor] xx:_order.order_num nn:self.numbL];
    if (_order.user_nick.length == 0) {
        
        self.userNameL.text = [NSString stringWithFormat:@"获得者:  Loading..."];
        [self.countL setHidden:YES];
    }else{
        
        [self.countL setHidden:NO];
        self.userNameL.text = [NSString stringWithFormat:@"获得者:  %@",_order.user_nick];
        self.countL.text = [NSString stringWithFormat:@"%@人次",_order.user_num];
        [WH_AppTools changeColor:self.countL.text color:[UIColor redColor] xx:_order.user_num nn:self.countL];
    }
    
    self.productTimeL.text = [NSString stringWithFormat:@"期  号  :  %@",_order.product_period_no];
    self.orderTimeL.text = [NSString stringWithFormat:@"夺宝时间:  %@",_order.order_time];
    if (![_order.win_num isEqualToString:@"0"]) {
        
        self.winNumL.text = [NSString stringWithFormat:@"本期幸运号码:  %@",_order.win_num];
        [WH_AppTools changeColor:self.winNumL.text color:[UIColor redColor] xx:_order.win_num nn:self.winNumL];

    }else{
        
        self.winNumL.text = [NSString stringWithFormat:@"本期幸运号码:  Loading..."];

    }
    

    
}
- (IBAction)codeDetailTo:(id)sender {
    
    [self.delegate pushToorderDetail:_order];
    NSLog(@"orderID==%@",_order.user_id);
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
